import { Entity, Column, PrimaryGeneratedColumn, OneToOne } from 'typeorm'

import { IdCard } from './idCard.entity'


@Entity({ name: 'user' })
export class User {
    //自增列
    @PrimaryGeneratedColumn()
    id: number
    //普通列
    @Column({
        type: 'varchar',
        length: 50,
        name: 'name'
    })
    name: string

    // 身份证和人一对一
    @OneToOne(() => IdCard, idCard => idCard.user)
    idCard: IdCard

}